#define _CRT_SECURE_NO_WARNINGS 1

#include <stdio.h>

int count = 0;

void move(char src, char dest)
{
	count++;
	printf("%c-->%c ", src, dest);
}

void hanoi(int n, char a, char b, char c)
{
	if (n == 1)
	{
		move(a, c);
	}
	else
	{
		hanoi(n - 1, a, c, b);
		move(a, c);
		hanoi(n - 1, b, a, c);
	}
}

int main()
{
	int n;
	scanf("%d", &n);
	char a = 'A';
	char b = 'B';
	char c = 'C';
	hanoi(n,a,b,c);
	printf("\n%d", count);
	return 0;
}